home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-11-15 | 4.4 KB | 144 lines | [ttro/ttxt] |
-
- ____________________________________________________
-
- Join List (ie, Detokenize) ver. 1.1
-
- Copyright (C) 1994 Wayne Walrath
-
- ____________________________________________________
-
- This software is free for personal use. To obtain a cheap and simple license
- for
- corporate, commercial or institutional use, contact the author at one of the
- addresses listed at the end of this document. THIS SOFTWARE IS PROVIDED AS IS
- WITHOUT WARRANTIES. USE AT YOUR OWN RISK! You are encouraged to share this
- software with other people and to upload it to online services, but you may
- not
- charge money for it and you should only transfer the complete package. Contact
- me if you doubt whether you have a complete package. Inclusion on CD-ROMs
- requires explicit permission from me (the author).
-
-
- Join List is an AppleScript Scripting Addition (OSAX) which forms a string
- from a list of items, inserting delimiters between the strings.
-
-
- Join List ver 1.1 includes several changes from the ver 1.0 Join List. Please
- see the end of this document for a summary of the changes.
-
-
- INSTALLATION:
- ______________________
- To install: Drag Join List to the Scripting Additions folder inside the
- Extensions folder.
-
-
-
- USAGE:
- _______________
-
- join list <list of strings> with delimiters <list of delims>
-
-
- the first <string> parameter is a list of zero or more strings to make one
- string out of. There is no limit on the size of the items other than
- available memory.
-
- the <list of delims> is a list of zero or more items to insert between the
- items
- of the first list. There is no limit on the size of the tokens other than
- available memory.
-
-
-
- Delimiters are inserted between items of the first list sequentially; when the
- end of the delimiter list is reached, the Scripting Addition begins again with
- the first delimiter (so in effect, they are inserted in a rotating fashion).
-
-
- ** ** ** ** ** ** ** **
-
- CLARIFICATION TO USAGE:
- _______________
-
- Here are a couple samples to clarify how Join List works.
- set jList to {"Join", "List", "Ver1.0" }
- set dList to {space}
-
- join list jList with delimiters dList
- => "Join List Ver1.0"
-
- The _space_ character is repeatedly inserted between the items in the first
- list. I don't think this needs much more explaining, so let's move on to more
- complex examples.
-
- set jList to {"One", "Two", "Three", "Four", "Five" }
- set dList to {"$","#"}
- join list jList with delimiters dList
- => "One$Two#Three$Four#Five"
-
- The "$" is inserted between the first two items and the "#" between the second
- and third items, then because the end of the delimiter list was reached, it
- starts over at the beginning of the delimiters again with "$", continuing on in
- this manner until all of the strings in jList have been added.
-
-
- If an empty list of delimiters is specified ({}), the command behaves exactly as
- if you had used AppleScript to coerce the list of strings to a single string.
-
- set jList to {"One", "Two", "Three", "Four", "Five"}
- join list jList with delimiters {}
- => "OneTwoThreeFourFive"
-
-
- If the list of strings to be joined contains only a single element, join list
- returns just that element with none of the tokens appeneded.
-
- join list "one" with delimiters {"&", "*"}
- => "one"
-
-
- If you want any of your delimiters on the front or end of the returned string,
- use AppleScript's built-in capabilities for this.
-
- set jList to {"One", "Two", "Three", "Four", "Five" }
- set myString to "|" & (join list jList with delimiters "|") & "|"
- => "|One|Two|Three|Four|Five|"
-
- Notice in this last example how I passed "|" as the delimiter; since it was only
- a single item, the AppleEvent manager handles coercing the string to a list for
- the join list OSAX. This only works with a single item, if there are more items
- you must make them into a list when calling join list.
-
- For more examples, see the included demo script.
-
-
- CHANGE LOG:
- _______________
- * ver 1.1 15Nov94
- - Removed limit on size of delimiter items.
- - Removed the syntax for choosing where to insert delimiters and the optional
- ending paramter.
-
- * ver1.0 2Nov94
- - First public release.
-
- ______________________
- Comments, bug reports and suggestions are welcomed. If you have any ideas for
- useful Scripting Additions which haven't been written yet, send me a message
- describing your idea.
-
-
- ___________________________
- Wayne Walrath
- 2010 Ravenswood Dr.
- Evansville, IN 47714
- (812) 476-8610
- walrath@cs.indiana.edu
- CIS: 70233,3151
- ___________________________
-
-
- We now return you to the regularly
- scheduled program already in progress...
-